package org.jederik.studip.android.view;

import org.jederik.android.provider.StudIP;
import org.jederik.android.provider.StudIP.Courses;
import org.jederik.studip.android.R;
import org.jederik.studip.android.view.tools.ResourceActivity;

import android.database.Cursor;
import android.widget.TextView;

public class ViewCourseDetails extends ResourceActivity {

	private static final String TAG = "ViewCourseDetails";

	@Override
	public void showData(Cursor cursor) {

		if (cursor == null || !cursor.moveToFirst()) {
			// TODO display Error
			return;
		}
		
		// Titel in Titelzeile einfügen:
		TextView title = (TextView) findViewById(R.id.title);
		title.setText(cursor.getString(cursor.getColumnIndex(Courses.Details.TITLE)));
		
		// Untertitel in Untertitelzeile einfügen:
		TextView subtitle = (TextView) findViewById(R.id.subtitle);
		subtitle.setText(cursor.getString(cursor.getColumnIndex(Courses.Details.SUBTITLE)));
		
		// Beschreibung in Beschreibungszeile einfügen:
		TextView description = (TextView) findViewById(R.id.description);
		description.setText(cursor.getString(cursor.getColumnIndex(Courses.Details.DESCRIPTION)));
		
		// Ort in Ort-Zeile einfügen:
		TextView location = (TextView) findViewById(R.id.location);
		location.setText(cursor.getString(cursor.getColumnIndex(Courses.Details.LOCATION)));
	}

	@Override
	public String getType() {
		return StudIP.TYPE_COURSE;
	}

	@Override
	public void initView() {
		setContentView(R.layout.view_course_details);
	}

	@Override
	public String getId() {
		return getIntent().getData().getPathSegments().get(1);
	}
	
	@Override
	public void setVisited() {
		
	}

	@Override
	public boolean canBeVisited() {
		return false;
	}

}
